#include "fonticon.h"
#include <QFontDatabase>

FontIcon &FontIcon::Instance()
{
    static FontIcon _instance;
    return _instance;
}

QFont FontIcon::getFont()
{
    return this->font;
}

QChar FontIcon::getIconChar(FontIcon::IconIdentity code)
{
    return QChar((int)code);
}

FontIcon::FontIcon()
{
    // add font file
    int fontId = QFontDatabase::addApplicationFont("://content/fonts/fontawesome-webfont.ttf");
    QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);

    Q_ASSERT_X(fontFamilies.size()==1,"font","font not exist.");

    this->font.setFamily(fontFamilies.at(0));
}
